<?php
global $XOOPSGALLERY_module, $XOOPSGALLERY_moduleConfig;
if (!isset($XOOPSGALLERY_module) || !isset($XOOPSGALLERY_moduleConfig)) {
	// Get the proper Module handler and config for xoopsgallery
	if (isset($xoopsModule) && $xoopsModule->getVar('dirname') == 'xoopsgallery') {
		$XOOPSGALLERY_module =& $xoopsModule;
		$XOOPSGALLERY_moduleConfig =& $xoopsModuleConfig;
	} else {
		$XOOPSGALLERY_module_handler =& xoops_gethandler('module');
		$XOOPSGALLERY_config_handler =& xoops_gethandler('config');
		$XOOPSGALLERY_module =& $XOOPSGALLERY_module_handler->getByDirname('xoopsgallery');
		$XOOPSGALLERY_moduleConfig =& $XOOPSGALLERY_config_handler->getConfigsByCat(0, $XOOPSGALLERY_module->getVar('mid'));
	}
}

global $gallery;
if (!isset($gallery)) { 
        $gallery = new stdClass(); 
}
if (!isset($gallery->app)) { 
        $gallery->app = new stdClass(); 
}

/* Version */ 
$gallery->version = "1.3.3.7";
$gallery->url = "http://xoopsgallery.org/";
$gallery->app->config_version = 31; 
$gallery->album_version = 6;
$gallery->remote_protocol_version = 2.1;

// WHY is this necessary?  setting XOOPSGALLERY_moduleConfig global doesn't seem to work!
$gallery->config = $XOOPSGALLERY_moduleConfig;
  
/* Features */ 
$gallery->app->feature["zip"] = 1;
$gallery->app->zipinfo = $XOOPSGALLERY_moduleConfig['zipinfo'];
$gallery->app->unzip = $XOOPSGALLERY_moduleConfig['unzip'];
$gallery->app->use_ffmpeg = $XOOPSGALLERY_moduleConfig['use_ffmpeg'] ? _YES : _NO;
$gallery->app->ffmpeg = $XOOPSGALLERY_moduleConfig['ffmpeg'];
$gallery->app->skip_permission_checks = $XOOPSGALLERY_moduleConfig['skip_permission_checks'];
$gallery->app->feature["rewrite"] = 0; // (missing <i>GALLERY_REWRITE_OK</i> -- it's optional)
$gallery->app->feature["mirror"] = 0; // (missing <i>mirrorSites</i> -- it's optional)

/* Constants */  
$gallery->app->galleryTitle = $XOOPSGALLERY_module->getVar('name');
$gallery->app->pnmDir = $XOOPSGALLERY_moduleConfig['pnmDir'];  
$gallery->app->ImPath = $XOOPSGALLERY_moduleConfig['ImPath']; 
$gallery->app->graphics = $XOOPSGALLERY_moduleConfig['graphics'];
$gallery->app->albumDir = XOOPS_ROOT_PATH.'/modules/xoopsgallery/cache/albums';  
$gallery->app->tmpDir = XOOPS_ROOT_PATH.'/modules/xoopsgallery/cache/tmp';  
$gallery->app->photoAlbumURL = XOOPS_URL.'/modules/xoopsgallery';  
$gallery->app->albumDirURL = XOOPS_URL.'/modules/xoopsgallery/cache/albums';  
$gallery->app->imageDir = XOOPS_URL.'/modules/xoopsgallery/images';  
$gallery->app->highlight_size = $XOOPSGALLERY_moduleConfig['highlight_size'];  
$gallery->app->movieThumbnail = XOOPS_ROOT_PATH.'/modules/xoopsgallery/images/movie.thumb.jpg';  

// optional mirrorSites missing 
$gallery->app->showAlbumTree = $XOOPSGALLERY_moduleConfig['showAlbumTree'] ? _YES : _NO;
$gallery->app->showExif = $XOOPSGALLERY_moduleConfig['showExif'] ? _YES : _NO;
$gallery->app->showPreview = $XOOPSGALLERY_moduleConfig['showPhotoPreview'] ? _YES : _NO;
$gallery->app->use_exif = @file_exists($XOOPSGALLERY_moduleConfig['exifPath']) ? $XOOPSGALLERY_moduleConfig['exifPath'] : _NO;
$gallery->app->cacheExif = $XOOPSGALLERY_moduleConfig['exifCache'] ? _YES : _NO;
$gallery->app->jpegImageQuality = $XOOPSGALLERY_moduleConfig['jpegImageQuality'];  
$gallery->app->timeLimit = $XOOPSGALLERY_moduleConfig['operationTimeLimit'];  
$gallery->app->debug = $XOOPSGALLERY_moduleConfig['debug'] ? _YES : _NO;    
$gallery->app->use_flock = $XOOPSGALLERY_moduleConfig['use_flock'] ? _YES : _NO;    
$gallery->app->expectedExecStatus = "0";  
$gallery->app->sessionVar = "gallery_session";  
$gallery->app->userDir = XOOPS_ROOT_PATH.'/modules/xoopsgallery/cache/albums/.users';  
$gallery->app->pnmtojpeg = "ppmtojpeg";  
  
/* Defaults */  
$gallery->app->default["bordercolor"] = "black";  
$gallery->app->default["border"] = "1";  
$gallery->app->default["font"] = "arial";  
$gallery->app->default["cols"] = $XOOPSGALLERY_moduleConfig['cols'];  
$gallery->app->default["rows"] = $XOOPSGALLERY_moduleConfig['rows'];
$gallery->app->default["thumb_size"] = $XOOPSGALLERY_moduleConfig['thumb_size'];
$gallery->app->default["resize_size"] = $XOOPSGALLERY_moduleConfig['resize_size'];
$gallery->app->default["fit_to_window"] = $XOOPSGALLERY_moduleConfig['fit_to_window'] ? _YES : _NO;
$gallery->app->default["use_fullOnly"] = $XOOPSGALLERY_moduleConfig['use_fullOnly'] ? _YES : _NO;
$gallery->app->default["print_photos"] = $XOOPSGALLERY_moduleConfig['print_photos'];
$gallery->app->default["returnto"] = $XOOPSGALLERY_moduleConfig['returnto'] ? _YES : _NO;
$gallery->app->default["albumsPerPage"] = $XOOPSGALLERY_moduleConfig['albumsPerPage'];
$gallery->app->default["showSearchEngine"] = $XOOPSGALLERY_moduleConfig['showSearchEngine'] ? _YES : _NO;
$gallery->app->default["useOriginalFileNames"] = $XOOPSGALLERY_moduleConfig['useOriginalFileNames'] ? _YES : _NO;
$gallery->app->default["display_clicks"] = $XOOPSGALLERY_moduleConfig['display_clicks'] ? _YES : _NO;
$gallery->app->default["public_comments"] = _YES;  

?>
